package com.ruoyi.boss.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.boss.domain.TSendInterver;
import com.ruoyi.boss.service.ITSendInterverService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 特殊时段Controller
 * 
 * @author ruoyi
 * @date 2025-08-18
 */
@RestController
@RequestMapping("/interver")
public class TSendInterverController extends BaseController
{
    @Autowired
    private ITSendInterverService tSendInterverService;

    /**
     * 查询特殊时段列表
     */
    @RequiresPermissions("boss:interver:list")
    @GetMapping("/list")
    public TableDataInfo list(TSendInterver tSendInterver)
    {
        startPage();
        List<TSendInterver> list = tSendInterverService.selectTSendInterverList(tSendInterver);
        return getDataTable(list);
    }

    /**
     * 导出特殊时段列表
     */
    @RequiresPermissions("boss:interver:export")
    @Log(title = "特殊时段", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TSendInterver tSendInterver)
    {
        List<TSendInterver> list = tSendInterverService.selectTSendInterverList(tSendInterver);
        ExcelUtil<TSendInterver> util = new ExcelUtil<TSendInterver>(TSendInterver.class);
        util.exportExcel(response, list, "特殊时段数据");
    }

    /**
     * 获取特殊时段详细信息
     */
    @RequiresPermissions("boss:interver:query")
    @GetMapping(value = "/{sendInterverId}")
    public AjaxResult getInfo(@PathVariable("sendInterverId") Long sendInterverId)
    {
        return success(tSendInterverService.selectTSendInterverBySendInterverId(sendInterverId));
    }

    /**
     * 新增特殊时段
     */
    @RequiresPermissions("boss:interver:add")
    @Log(title = "特殊时段", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TSendInterver tSendInterver)
    {
        return toAjax(tSendInterverService.insertTSendInterver(tSendInterver));
    }

    /**
     * 修改特殊时段
     */
    @RequiresPermissions("boss:interver:edit")
    @Log(title = "特殊时段", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TSendInterver tSendInterver)
    {
        return toAjax(tSendInterverService.updateTSendInterver(tSendInterver));
    }

    /**
     * 删除特殊时段
     */
    @RequiresPermissions("boss:interver:remove")
    @Log(title = "特殊时段", businessType = BusinessType.DELETE)
	@DeleteMapping("/{sendInterverIds}")
    public AjaxResult remove(@PathVariable Long[] sendInterverIds)
    {
        return toAjax(tSendInterverService.deleteTSendInterverBySendInterverIds(sendInterverIds));
    }
}
